<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>Document</title>
</head>

<body>
    <div id="root">
        <form action="" @submit.prevent="demo">
            账号：<input type="text" v-model.trim="userInfo.account"><br>
            密码：<input type="password" v-model="userInfo.password"> <br>
            性别：
            男<input type="radio" name="sex" v-model="userInfo.sex" value="male">
            女<input type="radio" name="sex" v-model="userInfo.sex" value="female"><br>
            年龄<input type="number" name="age" v-model.number="userInfo.age"><br>
            爱好：
            学习<input type="checkbox" v-mode="userInfo.hobby" value="study">
            打游戏 <input type="checkbox" v-mode="userInfo.hobby" value="game">
            吃饭：<input type="checkbox" v-mode="userInfo.hobby" value="eat"><br>
            所属小区
            <section v-model="userInfo.city">
                <option value="">请选择校区</option>
                <option value="bj">北京</option>
                <option value="sh">上海</option>
                <option value="wh">武汉</option>
            </section><br>
            其他：<textareab v-model.lazy="userInfo.other"></textarea><br>
                <input type="checkbox" v-model="userInfo.agree">阅读并接受<a href="#">《用户协议》</a>
                <button>提交</button>
        </form>
    </div>
</body>
<script>
    Vue.config.productionTip = false
    const vm = new Vue({
        el: '#root',
        data: {
            userInfo: {
                account: '',
                passward: '',
                sex: 'female',
                age: '',
                hobby: [],
                city: 'bj',
                other: "",
                agree: ''
            }
        },
        methods: {
            demo() {
                console.log(JSON.stringify(this.userInfo))
            }
        },
    })
</script>

</html>